using Microsoft.VisualStudio.TestTools.UnitTesting;
using SSOTasks = BizTalk.BuildGenerator.Tasks.SSO;
using System.IO;

namespace BizTalk.BuildGenerator.Tasks.Tests.BRE
{
    /// <summary>
    /// Summary description for SSOTests
    /// </summary>
    [TestClass]
    public class BRETests : MSBuildTest
    {        
        /// <summary>
        /// Pretest setup
        /// </summary>
        [TestInitialize]
        public void Setup()
        {
            GetFileAndWriteToPath("BizTalk.BuildGenerator.Tasks.Tests.BRE.BRETestBuildScript.msbuild", "BRETestBuildScript.msbuild");
            GetFileAndWriteToPath("BizTalk.BuildGenerator.Tasks.Tests.BRE.TestPolicy.xml", "TestPolicy.xml");
            GetFileAndWriteToPath("BizTalk.BuildGenerator.Tasks.Tests.BRE.TestVocabulary.xml", "TestVocabulary.xml");            
        }
        /// <summary>
        /// Cleans after test
        /// </summary>
        [TestCleanup]
        public void CleanUp()
        {
            File.Delete("BRETestBuildScript.msbuild");
            File.Delete("TestVocabulary.xml");
            File.Delete("TestPolicy.xml");  
        }
        /// <summary>
        /// Tests the SSO tasks
        /// </summary>
        [TestMethod]
        public void ExecuteBREMsBuildTest()
        {
            const string arguments = "BRETestBuildScript.msbuild /t:Build";
            var result = RunMSBuild(arguments);
            Assert.IsTrue(result == 0, "The MSBuild Task failed.");
            
        }
    }
}
